package com.example.forum.mapper;

import com.example.forum.entity.Reply;
import com.example.forum.entity.Token;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ReplyMapper {

    @Insert("insert into reply(article_id,user_id,content)values(#{reply.articleId},#{reply.userId},#{reply.content})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    Integer insert(@Param("reply") Reply reply);

    @Select("select * from reply where article_id=#{id} order by id desc")
    List<Reply> replyList(@Param("id")Integer id);


}
